<?php
/**
 * Mechanism
 * 
 * LICENSE
 * 
 * This file is private intellectual property of the author. 
 * All rights reserved. Copying and illegal using is punishable by law.
 * 
 * @copyright Copyright (c) 2011 BreatheInMyVoid ( BreatheInMyVoid@gmail.com )
 */

namespace Mechanism\Loader\Resource {
	abstract class Resource implements IResource {
		protected $ds = null;
		protected $app_path = null;
		protected $app_namespace = 'Application';
		protected $modules_dir = 'modules';
		protected $modules_namespace = 'Module';

		public function __construct( $app_path = null ) {
			if ( null !== $app_path ) {
				$this->set_app_path( $app_path );
			}

			$this->ds = DIRECTORY_SEPARATOR;
		}

		public function set_app_path( $path ) {
			/* Normalize application path. Delete last slash */
			$this->app_path = ( $this->ds === substr( $path, -1, 1 ) ) ?
				substr( $path, 0, -1 ) :
				$path;
		}	

		public function set_app_namespace( $namespace ) {
			$this->app_namespace = $namespace;
		}

		public function set_modules_dir( $name ) {
			$this->modules_dir = $name;
		}

		public function set_modules_namespace( $namespace ) {
			$this->modules_namespace = $namespace;
		}

		public function get_app_path( ) {
			return $this->app_path;
		}

		public function get_app_namespace( ) {
			return $this->app_namespace;
		}

		public function get_modules_dir( ) {
			return $this->modules_dir;
		}

		public function get_modules_namespace( ) {
			return $this->modules_namespace;
		}
	}
}
